#ifndef FLOATBUTTON_H
#define FLOATBUTTON_H

#include <QWidget>
#include <QMenu>
#include <QVector>
#include "ConfigData.h"

class QLabel;


class FloatButton : public QWidget
{
    Q_OBJECT

  public:
    explicit FloatButton(QWidget *parent = nullptr);
    void show();

  protected:
    void mousePressEvent(QMouseEvent *event);
    void enterEvent(QEvent *event);
    void leaveEvent(QEvent *event);

  signals:
    void floatButtonPressed(QPoint mousePressPosition, QPoint mouseReleasedPosition, Translate::API type);

  private:
    QMenu floatButtonMenu;
    QAction notShow;
    QPoint mousePressPosition;
    QPoint mouseReleasedPosition;
    QVector<int> m_shownAPIs;
    int m_length;
    QString m_curAppName;
    QMetaEnum m_APIEnum;

public slots:
    void onContentPicked(QString appName, QString content);
    void onMouseButtonPressed(QPoint p);  // global listen
    void onMouseButtonReleased(QPoint p); // global listen


private slots:
    void onConfigChanged();
    void onNotShowActionTriggered();
};

#endif // FLOATBUTTON_H
